<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<jsp:include page="../header.jsp">
<jsp:param value="我的客户" name="title"/>
</jsp:include>
<link href="static/css/couselor.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="static/js/counselor.js" ></script>
<script type="text/javascript">
$(function(){
	$('#refresh').on('click',function(){
		location.replace("${basePath}${url}");
	});
});
</script>
</head>
<body>
<jsp:include page="../menu/menue.jsp"></jsp:include>
<jsp:include page="cou_checkout.jsp"></jsp:include>
<div class="teacher-content" style="margin-left: 150px; margin-right: 100px;">
	<table class="ui sortable celled table cou">
    <thead>
    <tr>
    <c:choose>
    <c:when test="${url eq 'counselor/allocated'}">
      	<th colspan="7" style="vertical-align:middle">
      	已分配部门学员
        <form action="counselor/allocated">
	    	<div class="ui mini icon input" style="float: right;">
	  			<input type="text" placeholder="请输入名字" name="stuName" value="${param.stuName }">
	  			<i class="search icon"></i>
			</div>
		</form>
    	</th>
    </c:when>
    <c:otherwise>
        	<th colspan="9" style="vertical-align:middle">
        	<c:if test="${url eq 'counselor/myfavor' }">我的协助
        	<form action="counselor/myfavor">
	    	<div class="ui mini icon input" style="float: right;">
	  			<input type="text" placeholder="请输入名字" name="stuName" value="${param.stuName }" >
	  			<i class="search icon"></i>
			</div>
			</form>
        	</c:if>
        	<c:if test="${url eq 'counselor/mycustomer' }">我的客户
        	<form action="counselor/mycustomer">
	    	<div class="ui mini icon input" style="float: right;">
	  			<input type="text" placeholder="请输入名字" name="stuName" value="${param.stuName }" >
	  			<i class="search icon"></i>
			</div>
		</form>
		</c:if>
		</th>
    </c:otherwise>
    </c:choose>
    </tr>
    <tr>
		    <th colspan="9">
    		<c:if test="${url eq 'counselor/mycustomer'}">
    		<div class="ui teal basic button" tabindex="0" id="delete">删除</div>
    		</c:if>
    		<c:if test="${url eq 'counselor/myfavor'}">
    		<div class="ui teal basic button" tabindex="0" id="delete">删除</div>
    		</c:if>
    		<div class="ui teal basic button" tabindex="0" id="refresh"> 刷新</div>
    		<div class="ui buttons" style="float:right;">
				<div class="teal ui  buttons">
					<a class="${url eq 'counselor/mycustomer' ? 'ui button active':'ui button' } "  href="counselor/mycustomer">潜在</a>
				  	<a class="${url eq 'counselor/myfavor' ? 'ui button active':'ui button' } " href="counselor/myfavor">我的协助</a>
				 	<a class="${url eq 'counselor/allocated' ? 'ui button active':'ui button' } " href="counselor/allocated">已入学</a>
				<c:if test="${url eq 'counselor/mycustomer'}">  <button class="ui button"  onclick="select()">筛选</button></c:if>
				</div>
			</div>
    	</th>
    </tr> 
      <tr>
      	<c:if test="${url eq 'counselor/mycustomer'}">
	      	<th>
		      	<div class="ui checkbox">
					<input type="checkbox" id="checkAll">
				</div>
			</th>
		</c:if>
     <c:if test="${url eq 'counselor/myfavor'}">
     	<th>
		    <div class="ui checkbox">
				<input type="checkbox" id="checkAll">
			</div>
		</th>
		</c:if>
        <th>姓名</th>
        <th>性别</th>
        <th>来源</th>
        <th>学历</th>
        <th>电话</th>
       <c:choose>
        <c:when test="${url eq 'counselor/myfavor'}">
         	<th>协助创建时间</th>
        </c:when>
        <c:otherwise>
        	<th>创建时间</th>
        </c:otherwise>
        </c:choose>
        <c:if test="${url eq 'counselor/myfavor'}">
        <th>下一次跟进</th>
        </c:if>
         <c:if test="${url eq 'counselor/mycustomer'}">
        <th>下一次跟进</th>
        </c:if>
        <th>客户状态</th>
      </tr>
    </thead>
    <tbody>
    <c:forEach items="${followStuList}" var="stuPo">
      <tr>
       <c:if test="${url eq 'counselor/mycustomer'}">
     	 <td>
	      	<div class="ui checkbox">
				<input type="checkbox" class="item-check" value="${stuPo.id}">
			</div>
		</td>
			</c:if>
			<c:if test="${url eq 'counselor/myfavor'}">
     	 <td>
	      	<div class="ui checkbox">
				<input type="checkbox" class="item-check" value="${stuPo.id}">
			</div>
		</td>
			</c:if>
        <td><a href = "customer/detail?id=${stuPo.id}">${stuPo.name}</a></td>
        <td>${stuPo.gender}</td>
        <td>${stuPo.source }</td>
        <td>${stuPo.education }</td>
        <td>${stuPo.phone}</td>
         <c:choose>
        <c:when test="${url eq 'counselor/myfavor'}">
         <td><fmt:formatDate value="${stuPo.asCreateTime}" type="both"></fmt:formatDate></td>
        </c:when>
        <c:otherwise>
        <td><fmt:formatDate value="${stuPo.createTime}" type="both"></fmt:formatDate></td>
        </c:otherwise>
        </c:choose>
         <c:if test="${url eq 'counselor/myfavor'}">
       	<td><fmt:formatDate value="${stuPo.nextTime }" type ="date"/></td>
       	</c:if>
       	<c:if test="${url eq 'counselor/mycustomer'}">
       	<td><fmt:formatDate value="${stuPo.nextTime }" type ="date"/></td>
       	</c:if>
        <td class="negative">${stuPo.stuGradeText }</td>
      </tr>
      </c:forEach>
      <c:if test="${empty followStuList}">
		<tr>
			<td style="text-align: center;" colspan="8">暂无记录</td>
		</tr>
	  </c:if>
    </tbody>
  </table>
  		<c:if test="${totalPage > 1 }">
			<div class="page">
				<a <c:if test="${page!=1}">href="${url}?page=1${queryString}"</c:if>
					class="${page==1?'disable':'' }">首页</a> <a
					<c:if test="${page!=1}">href="${url}?page=${page-1}${queryString}"</c:if>
					class="${page==1?'disable':''}">上一页</a> <a
					<c:if test="${page!=totalPage}">href="${url}?page=${page+1 }${queryString}"</c:if>
					class="${page==totalPage?'disable':''}">下一页</a> <a
					<c:if test="${page!=totalPage}">href="${url}?page=${totalPage }${queryString}"</c:if>
					class="${page==totalPage?'disable':''}">最后一页</a> <span class="tag">${page}/${ totalPage}
				</span>
			</div>
		</c:if>
  </div>
</body>
</html>